<?php

class SellersController extends AppController {

    var $name = 'Sellers';
    var $uses = array();

    function beforeFilter() {
        parent::beforeFilter();
        $this->Auth->allowedActions = array('*');
    }

    function index() {
        $this->layout = "innerhome";
        $this->loadModel('Category');
        $this->set('item', $this->Category->categoryArray());
    }

    function setting() {
        $this->layout = "innerhomeemail";
        $this->loadModel('Aprovalnotification');
        $chk = $this->Aprovalnotification->find('count', array('conditions' => array('Aprovalnotification.user_id' => $this->Auth->user('id'))));
        if ($chk == 0) {
            $this->data['Aprovalnotification']['id'] = null;
            $this->data['Aprovalnotification']['user_id'] = $this->Auth->user('id');
            $this->Aprovalnotification->save($this->data);
        }
        $setdata = $this->Aprovalnotification->find('first', array('conditions' => array('Aprovalnotification.user_id' => $this->Auth->user('id'))));
        $this->set('setdata', $setdata);
    }

    function setting_process($data=null) {
        $this->layout = null;
        $this->autoRender = FALSE;
        $this->loadModel('Aprovalnotification');
        $setdata = $this->Aprovalnotification->find('first', array('conditions' => array('Aprovalnotification.user_id' => $this->Auth->user('id'))));
        $this->data['Aprovalnotification']['status'] = $data;
        $this->Aprovalnotification->id = $setdata['Aprovalnotification']['id'];
        $this->Aprovalnotification->save($this->data);
    }

}

?>